import Layout from '../components/Layout'

const routes = [
  {
    path: '/',
    name: 'home',
    component: Layout
  },
  {
    path: '/product',
    component: Layout,
    redirect: '/err',
    children: [
      {
        path: 'detail',
        title: '商品详情',
        component: () => import('../views/productdetail')
      }
    ]
  },
  {
    path: '/center',
    title: '个人中心',
    component: Layout,
    children: [
      {
        path: '',
        name: 'center',
        component: () => import('../views/center')
      }
    ]
  },
  {
    path: '/myorder',
    title: '我的订单',
    component: Layout,
    children: [
      {
        path: '',
        name: 'myorder',
        component: () => import('../views/myorder')
      }
    ]
  },
  {
    path: '/search',
    title: '搜索',
    name: 'search',
    component: Layout
  },
  {
    path: '/shoppingcart',
    title: '购物车',
    component: Layout,
    children: [
      {
        path: '',
        name: 'shoppingcart',
        component: () => import('../views/shoppingcart')
      }
    ]
  },
  {
    path: '/order',
    title: '提交订单',
    name: 'order',
    component: () => import('../views/buy')
  },
  {
    path: '/login',
    title: '登录',
    component: () => import('../components/Login')
  },
  {
    path: '/err',
    component: () => import('../views/error/404')
  },
  {
    path: '*',
    redirect: '/err'

  }
]

export default routes
